const express = require('express');
const userRouter = require('./routes/user')
const bodyParser = require('body-parser');

// const mongoose = require('mongoose');
// const User = require('./models')

// mongoose.connect('mongodb://localhost:27017/chat');

const app = express();
app.use(bodyParser.urlencoded({ extended: false }));
// const connect = mongoose.connection;
//
// connect.on('error', () => {
//     console.log('数据库连接失败')
// })
//
// connect.on('open', () => {
//     console.log('数据库连接成功');
//
// })

app.use('/user', userRouter)

app.use(express.static('./public/'))

app.listen(8080, () => {
    console.log('listen at 8080')
})